

/***
 * 复杂子系统
 */
class Shape{
    draw(){
        throw new Error("please impl draw")
    }
} 

class Circle extends Shape{
    init(){
        console.log("初始化绘制工作")
    }
    draw(){
        console.log("我绘制的是圆形")
    }
    end(){
        console.log("收尾绘制工作")
    }
}

class Rectangle extends Shape{
    
    draw(){
        console.log("我绘制的是矩形")
    }
    fix(){
        console.log("修复绘制工作")
    }
}
class Square extends Shape{
    
    draw(){
        console.log("我绘制的是正方形")
    }
    mesure(){
        console.log("测量工作")
    }
}

/***
 * 调用者
 */
class ShapeMaker{
    constructor(){
        this.rectangle = new Rectangle()
        this.circle = new Circle()
        this.square = new Square()
    }
    drawRectangle(){
        this.rectangle.draw()
    }
    drawCircl(){
        this.circle.draw()
    }
    drawSquare(){
        this.square.draw()
        // this.square.mesure()
    }
}

new ShapeMaker().drawCircl()
